{% extends 'base.html' %}
{% load static %}
{% load i18n %}
{% load  sizeformat %}

{% block head %}
    <link rel="stylesheet" type="text/css" href="{% static 'network/vlan_list.css' %}">
{% endblock %}
{% block title %}{% translate 'IP列表' %}{% endblock %}

{% block boby %}
    <div class="col-md-12">
        <div class="card">
            <div class="card-header">
                <span class="card-title"><strong>{% translate 'IP列表' %}</strong></span>
                <span><a class="btn btn-sm btn-primary float-right" href="{% url 'network:vlan_show' %}?vlan_id={{ vlan_id }}&iptype=ipv4">
                    <i class="fa fa-download"></i> {% translate '导出ipv4配置文件' %}
                </a></span>
                <span><a class="btn btn-sm btn-primary float-right" href="{% url 'network:vlan_show' %}?vlan_id={{ vlan_id }}&iptype=ipv6">
                    <i class="fa fa-download"></i> {% translate '导出ipv6配置文件' %}
                </a></span>
            </div>
            <div class="card-body" style="min-height: 400px;">
                <table class="table table-vm-list" style="word-wrap:break-word;word-break:break-all;">
                    <thead class="thead-light">
                    <tr>
                        <th>{% translate '编号' %}</th>
                        <th>IP{% translate '地址' %}</th>
                        <th>IPv6{% translate '地址' %}</th>
                        <th>MAC{% translate '地址' %}</th>
                        <th>{% translate '主机编号' %}</th>
                        <th>{% translate '主机编号' %}（{% translate '附加' %}）</th>
                        <th>{% translate '状态' %}</th>
                    </tr>
                    </thead>
                    <tbody>
                    {% for macip in macips %}
                    <tr>
                        <th>{{ macip.id }}</th>
                        <th>{{ macip.ipv4 }}</th>
                        <th>{{ macip.ipv6 | default_if_none:'' }}</th>
                        <th>{{ macip.mac }}</th>
                        <th>{{ macip.host_uuid }}</th>
                        <th>{{ macip.get_attach_ip_vm }}</th>
                        {% if macip.enable %}
                            <th><i class="fa fa-check"></i></th>
                        {% else %}
                            <th><i class="fa fa-times"></i></th>
                        {% endif %}
                    </tr>
                    {% endfor %}
                    </tbody>
                </table>
            </div>
        </div>
    </div>
{% endblock %}

{% block script %}
    <script type="text/javascript" src="{% static 'network/vlan_list.js' %}"></script>
{% endblock %}

